from enum import unique
from app import db
#创建用户表
class User(db.Model):
    __tablename__='user_info'
    id = db.Column(db.Integer,primary_key=True,autoincrement=True)
    username = db.Column(db.String(40),unique=True)
    password = db.Column(db.String(200),default='')
    mobile = db.Column(db.String(11),default='')
    avater = db.Column(db.String(200),default='')

#记录表record
class Record(db.Model):
    __tablename__ = 'record'
    id = db.Column(db.Integer,primary_key=True,autoincrement=True)
    username = db.Column(db.String(20))
    recordtime = db.Column(db.DateTime)
    count = db.Column(db.Integer)

#课程表
class Course(db.Model):
    __tablename__ = 'coures'
    id = db.Column(db.Integer,primary_key=True,autoincrement=True)
    name = db.Column(db.String(20))
    img = db.Column(db.String(200),default='')

#创建分类表
class Cart(db.Model):   
    __tablename__ = 'cart'
    id = db.Column(db.Integer,primary_key=True,autoincrement=True)
    name = db.Column(db.String(100),unique=True)
    level = db.Column(db.Integer,default=1) #等级
    parent = db.Column(db.Integer,default=0) #父类
    params = db.Column(db.String(255),default='') #动态参数 存放json'


